<script type="text/javascript" charset="utf-8">
function redirectPage (url) {
        document.location = url;
} // redirectPage

function enlarge (i) {
        $$('div.enlarge').invoke('addClassName', 'hide');
        $('image_'+i).removeClassName('hide');
        $$('div.previewImage').invoke('removeClassName', 'selected').invoke('addClassName', 'fade');
        $('thumb_'+i).addClassName('selected').removeClassName('fade');
} // enlarge
</script>

<div class="adPosts view">
<?php if (isset($manage)) { ?>
<?php     if ($adPost['AdPost']['active']) { ?>
  <div style="background-color:#99FF99; margin-bottom:10px; font-size:16px;">
    <p><?php __('This posting has been published'); ?></p>
    <p><?php __('Below is a preview of your posting.'); ?></p>
    <p><?php __('To unpublish, edit or delete it use the buttons below:'); ?></p>
    <input type="button" id="unpublishpost" value="<?php __('Unpublish'); ?>" style="margin:5px;" onclick="redirectPage('<?php e($this->base); ?>/adPosts/unpublish/<?php e($geturl); ?>')" />
    <input type="button" id="editpost" value="<?php __('edit'); ?>" style="margin:5px;" onclick="redirectPage('<?php e($this->base); ?>/adPosts/edit/<?php e($geturl); ?>')" />
    <input type="button" id="deletepost" value="<?php __('delete'); ?>" style="margin:5px;" onclick="redirectPage('<?php e($this->base); ?>/adPosts/delete/<?php e($geturl); ?>')" />
  </div>
<?php     } else { ?>
  <div style="background-color:#CC9933; margin-bottom:10px; font-size:16px;">
    <p><?php __('This posting has not been published'); ?></p>
    <p><?php __('Below is a preview of your posting.'); ?></p>
    <p><?php __('You may publish it, edit it, or delete it using the buttons below:'); ?></p>
    <input type="button" id="publishpost" value="<?php __('Publish'); ?>" style="margin:5px;" onclick="redirectPage('<?php e($this->base); ?>/adPosts/publish/<?php e($geturl); ?>')" />
    <input type="button" id="editpost" value="<?php __('edit'); ?>" style="margin:5px;" onclick="redirectPage('<?php e($this->base); ?>/adPosts/edit/<?php e($geturl); ?>')" />
    <input type="button" id="deletepost" value="<?php __('delete'); ?>" style="margin:5px;" onclick="redirectPage('<?php e($this->base); ?>/adPosts/delete/<?php e($geturl); ?>')" />
  </div>
<?php     } ?>
<?php } ?>
<a href="<?php echo $this->base; ?>/"><?php __($sitename); ?></a> &gt;
<?php __($adPost['AdCategory']['parent']); ?> &gt;
<?php echo $html->link(__($adPost['AdCategory']['category'],true), '/adPosts/browse/'.$adPost['AdCategory']['id']); ?>
  <div class="dr paging" style="height:20px;">
<?php if (isset($neighbors['prev']['AdPost']) || isset($neighbors['next']['AdPost'])) { ?>
<?php     echo (isset($neighbors['prev']['AdPost'])) ?
    $html->link('< '.__('Previous',true), '/adPosts/view/'.$neighbors['prev']['AdPost']['id']) :
    '<div class="disabled">&lt; '.__('Previous',true).'</div>'; ?>
    |
<?php     echo (isset($neighbors['next']['AdPost'])) ?
    $html->link(__('Next',true).' >', '/adPosts/view/'.$neighbors['next']['AdPost']['id']) :
    '<div class="disabled">'.__('Next',true).' &gt;</div>'; ?>
<?php } ?>
  </div>
  <div class="clear" style="border-bottom:1px solid #C0C0C0; padding-bottom:8px; margin-bottom:20px;">
    <div class="dl">
      <h3><?php echo $adPost['AdPost']['title']; ?></h3>
<?php if ($adPost['AdPost']['price'] && $adPost['AdPost']['price'] != '0.00') { ?>
      <h3><?php __('Price'); ?>: <?php echo $adPost['AdPost']['currency']; ?><?php echo $adPost['AdPost']['price']; ?></h3>
<?php } ?>
    </div>
    <div class="dr" style="padding-top:10px; text-align:right;">
      <span class="bold"><?php __('Ad ID'); ?>: </span><?php echo $adPost['AdPost']['id']; ?><br />
      <span class="bold"><?php __('Visit'); ?>: </span><?php echo $adPost['AdPost']['visit']; ?>
    </div>
    <div class="clear"></div>
  </div>
  <div class="dl" style="width:50%;">
    <div>
      <span class="bold"><?php __('Location'); ?>: </span>
      <span><?php echo $adPost['Location']['name'].', '.$adPost['AdPost']['location']; ?></span>
    </div>
    <div>
      <span class="bold"><?php __('Contact'); ?>: </span>
      <span>
        <a href="mailto:<?php echo $adPost['User']['email']; ?>"><u><?php echo $adPost['User']['email']; ?></u></a>
      </span>
    </div>
    <div>
      <span class="bold"><?php __('Date Listed'); ?>: </span>
      <span><?php echo $time->format('l, F j, Y', $adPost['AdPost']['created'], false, $zone); ?></span>
    </div>
<?php if ($adPost['AdPost']['condition']) { ?>
    <div>
      <span class="bold"><?php __('Condition'); ?>: </span>
      <span><?php ($adPost['AdPost']['condition'] == 'N') ? __('New') : __('Used'); ?></span>
    </div>
<?php } ?>
    <div style="margin-top:15px;">
      <div class="bold"><?php __('Description'); ?></div>
	  <div style="padding-left:8px;">
        <?php echo nl2br($adPost['AdPost']['description']); ?>
      </div>
    </div>
  </div>
  <div class="dl" style="width:50%;">
<?php if (!empty($adPost['AdImage'])) { ?>
    <div class="bold"><?php __('Image'); ?></div>
    <div style="border:1px solid #97BC5F; padding:8px; margin-top:5px; width:300px; text-align:center;">
<?php     foreach ($adPost['AdImage'] as $i=>$adImage) {
              $display = ($adPost['DefaultImage']['id'] == $adImage['id'])?'':' hide'; ?>
        <div id="image_<?php e($i); ?>" class="enlarge<?php e($display); ?>" style="width:300px; height:300px;
         background:url(<?php echo $this->base.'/img/images/'.$adImage['filename']; ?>) center center no-repeat;"></div>
<?php     } ?>
<?php     if (count($adPost['AdImage']) > 1) {
              foreach ($adPost['AdImage'] as $i=>$adImage) {
                  $selected = ($adPost['DefaultImage']['id'] == $adImage['id'])?' selected':' fade'; ?>
        <div id="thumb_<?php e($i); ?>" class="dl hand previewImage<?php e($selected); ?>" onclick="enlarge(<?php e($i); ?>)" style="margin:10px 5px 0 5px;
         background-image:url(<?php echo $this->base.'/img/images/s_'.$adImage['filename']; ?>);"></div>
<?php         }
          } ?>
        <div class="clear"></div>
    </div>
<?php } ?>
  </div>
</div>
